package com.pwc.conversionTool.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Transient;

import org.codehaus.jackson.annotate.JsonIgnore;

import com.google.appengine.api.blobstore.BlobInfo;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Ignore;
import com.googlecode.objectify.annotation.Index;

@Entity
public class Task implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7425891672617048688L;

	@Id
	private Long id;

	private String taskName;

	private Key<Operation> operation;

	private List<String> files;

	@Index private Key<TaskFlow> taskFlowKey;
	
	@Index private Key<Task> nextTaskKey;
	
	private String errorPath;
	
	private String errorValue;
	
	@Ignore
	private TaskLog taskLog;

	

	public Task(Long id, String taskName, Key<Operation> operation, List<String> files, Key<TaskFlow> taskFlowKey) {
		super();
		this.id = id;
		this.taskName = taskName;
		this.operation = operation;
		this.files = files;
		this.taskFlowKey = taskFlowKey;
	}

	public Task() {
		super();
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getTaskName() {
		return taskName;
	}

	public void setTaskName(String taskName) {
		this.taskName = taskName;
	}
	
	@JsonIgnore
	public Key<Operation> getOperation() {
		return operation;
	}

	public void setOperation(Key<Operation> operation) {
		this.operation = operation;
	}
	
	@JsonIgnore
	public List<String> getFiles() {
		return files;
	}

	public void setFiles(List<String> files) {
		this.files = files;
	}
	@JsonIgnore
	public Key<TaskFlow> getTaskFlowKey() {
		return taskFlowKey;
	}

	public void setTaskFlowKey(Key<TaskFlow> taskFlowKey) {
		this.taskFlowKey = taskFlowKey;
	}
	
	@JsonIgnore
	public Key<Task> getNextTaskKey() {
		return nextTaskKey;
	}

	public void setNextTaskKey(Key<Task> nextTaskKey) {
		this.nextTaskKey = nextTaskKey;
	}
	
	public String getErrorPath() {
		return errorPath;
	}

	public void setErrorPath(String errorPath) {
		this.errorPath = errorPath;
	}


	
	public String getErrorValue() {
		return errorValue;
	}

	public void setErrorValue(String errorValue) {
		this.errorValue = errorValue;
	}

	public TaskLog getTaskLog() {
		return taskLog;
	}

	public void setTaskLog(TaskLog taskLog) {
		this.taskLog = taskLog;
	}

	@JsonIgnore
	@Transient
	public Key<Task> getKey() {
		return Key.create(Task.class, id);
	}


}
